{extend name="admin/public/layout" /}
{block name="content"}<template id="app">
    <div>
        {:widget('before_content')}
        <div class="form-tab">
            <a-tabs v-if="Object.keys(tabs).length > 1" type="card" v-model="activeTab">
                <a-tab-pane v-for="(item,key) in tabs" :key="key" :tab="item"></a-tab-pane>
            </a-tabs>
        </div>
        <a-form-model class="form" ref="ruleForm" :model="form" :rules="rules" :label-col="{span: 3}"
            :wrapper-col="{span: 18}">
            {:widget('before_form_item')}
            <div v-show="activeTab == 'base'">
                <a-form-model-item prop='title' label='标题'>
                    <a-input placeholder='请输入标题' v-model='form.title'></a-input>
                </a-form-model-item>
                <a-form-model-item prop='type' label='计费方式'>
                    <a-select mode='default' v-model='form.type'>
                        <a-select-option :value="0">按重量</a-select-option>
                        <a-select-option :value="1">按件数</a-select-option>
                    </a-select>
                </a-form-model-item>
                <a-form-model-item prop='sort' label='排序'>
                    <a-input-number v-model='form.sort' step='1'></a-input-number>
                </a-form-model-item>
                <a-form-model-item prop='is_default' label='默认'>
                    <a-switch v-model='form.is_default' />
                </a-form-model-item>
            </div>
            {:widget('after_form_item')}
            <a-form-item class="fixed-bottom-btn-group" :wrapper-col="{ span: 14, offset: 4 }">
                <a-button class="btn" :loading="btnLoading" type="primary" @click="onSubmit">提交</a-button>
                <a-button class="btn" @click="onCancel">取消</a-button>
            </a-form-item>
        </a-form-model>

        {:widget('after_content')}
    </div>
</template>
{/block}
{block name="style"}
{:widget('style')}
{/block}
{block name="scripts"}
{:widget('scripts')}
{/block}